gh-134584: Eliminate redundant refcounting from TO_BOOL_STR#143417
gh-134584: Eliminate redundant refcounting from TO_BOOL_STR#143417Fidget-Spinner merged 7 commits intopython:mainfrom
TO_BOOL_STR#143417Conversation
Signed-off-by: Manjusaka <[email protected]>
Python/optimizer_bytecodes.c
Outdated
|
|
||
| op(_TO_BOOL_STR, (value -- res)) { | ||
| op(_TO_BOOL_STR, (value -- res, v)) { | ||
| int already_bool = optimize_to_bool(this_instr, ctx, value, &res); |
There was a problem hiding this comment.
This optimization is broken because the stack effect changed,
You need to fix optimize_to_bool to allow for an insert mode, so it should be the same as the one in her https://github.com/python/cpython/pull/143335/files (see _INSERT_1_LOAD_CONST_INLINE_BORROW)
So optimize_to_bool(this_instr, ctx, value, &res, true);, where true is for insert_mode, which will change to opcode to _INSERT_1_LOAD_CONST_INLINE_BORROW
There was a problem hiding this comment.
I can do this change, as it's a little more complex
There was a problem hiding this comment.
Thanks for the suggestion! TIL
I may need a little bit time to update the patch(lol
There was a problem hiding this comment.
I can do this change, as it's a little more complex
If this is possible, I would like to make this change!
There was a problem hiding this comment.
I have complete the code on my local branch, not push. Because I have some issue about this part
I think the patch, I will use _INSERT_1_LOAD_CONST_INLINE_BORROW but this is made in #143335
For now, I add a tier2 op named _INSERT_1_LOAD_CONST_INLINE_BORROW copy from #143335. I'm not sure if this is OK?
There was a problem hiding this comment.
Yeah just copy the op over
Signed-off-by: Manjusaka <[email protected]>
|
Please fix the merge conflicts. Thanks! |
Signed-off-by: Manjusaka <[email protected]>
Sorry about this, seems new commit merged in main. Fixed |
Uh oh!
There was an error while loading. Please reload this page.